export const crudOptions = vm => {
  return {
    indexRow: {
      title: '序号',
      align: 'center'
    },
    options: {
      height: '100%'
    },
    columns: [
      {
        title: '用户名',
        key: 'username',
        align: 'center',
        search: {
          disabled: false
        },
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入用户名' },
            { min: 1, max: 10, trigger: 'blur', message: '用户名长度在1-10个字符之间' }
          ]
        },
      },
      {
        title: '密码',
        key: 'password',
        type: 'password',
        show: false,
        addForm: {
          disabled: false,

        },
        editForm: {
          disabled: true
        }
      },
      {
        title: '手机号码',
        key: 'phone',
        align: 'center',
        search: {
          disabled: false
        },
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入电话' },
            { pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, trigger: 'blur', message: '请输入正确的手机号码' }
          ]
        }
      },
      {
        title: '角色',
        key: 'role',
        align: 'center',
        type: 'select',
        dict: {
          data: [
            {
              value: 0,
              label: '超级管理员'
            },
            {
              value: 1,
              label: '血库管理员'
            },
            {
              value: 2,
              label: '献血点管理员'
            },
          ]
        },
        search: {
          disabled: false,
          show: false
        },
        form: {
          disabled: false,
          rules: [
            { required: true, trigger: 'blur', message: '请选择管理员身份' }
          ],
          component: {
            name: 'dict-select',
            props: {
              filterable: true,
              multiple: false,
              clearable: true
            }
          }
        }
      }
    ],
    rowHandle: {
      view: false,
      align: 'center'
    }
  }
}